<script setup>
import { Setting, Brush, Tools, Edit } from '@element-plus/icons-vue'
import { onMounted } from 'vue'
const props = defineProps({
  activeMenu: {
    type: String,
    required: true,
    default: 'appearance'
  }
})

const emit = defineEmits(['update:activeMenu'])

const menuItems = [
  { key: 'appearance', label: '通用设置', icon: Brush },
  { key: 'config', label: 'API设置', icon: Tools },
  { key: 'edit', label: '账户管理', icon: Edit }
]

const handleMenuClick = (key) => {
  emit('update:activeMenu', key)
}

</script>

<template>
  <div class="settings-menu">
    <div
      v-for="item in menuItems"
      :key="item.key"
      class="menu-item"
      :class="{ active: activeMenu === item.key }"
      @click="handleMenuClick(item.key)"
    >
      <el-icon><component :is="item.icon" /></el-icon>
      <span>{{ item.label }}</span>
    </div>
  </div>
</template>

<style scoped>
.settings-menu {
  width: 200px;
  border-right: 1px solid var(--el-border-color-lighter);
  padding: 16px 0;
  background-color: var(--el-bg-color);
  border-radius: 8px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--el-text-color-regular);
  border-radius: 6px;
  margin: 0 8px;
}

.menu-item:hover {
  background-color: var(--menu-hover-bg);
  color: var(--menu-text-hover-color);
}

.menu-item.active {
  background-color: var(--menu-active-bg);
  color: var(--el-text-color-regular);
}

.menu-item .el-icon {
  font-size: 18px;
}
</style>
